package com.cg.controller;

import com.cg.client.UserClient;
import com.cg.dto.Dto;
import com.cg.dto.LoginDto;
import com.cg.dto.RegDto;
import com.cg.dto.UserRegDto;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/p")
public class UserController {

    @Resource
    private UserClient userClient;


    @PostMapping("/login")
    public Dto<Object[]> login(@RequestBody LoginDto loginDto){
        return userClient.login(loginDto);
    }


    @PostMapping("/code")
    public Dto sendSms(@RequestBody UserRegDto userRegDto){
        return userClient.sendSms(userRegDto);
    }


    @PostMapping("/checkEmail")
    public Dto checkEmail(@RequestBody UserRegDto userRegDto){
        return userClient.checkEmail(userRegDto);
    }

    //新用户注册
    @PostMapping("/register")
    public Dto register(@RequestBody RegDto regDto){
        return userClient.register(regDto);
    }
}
